Scripting Reference

PreviousUpNext

These are the script commands (in alphabetical order):

ATTRIB BEEP COLLAPSE COMPARE COPY COPYTO CRITERIA DELETE EXPAND FILE-REPORT FILTER FOLDER-REPORT LOAD LOG MOVE OPTION RENAME SELECT SNAPSHOT SYNC TOUCH


ATTRIB win

Usage:

attrib (+|-)<attrib set 1> [(+|-)<attrib set 2> <...>]

 

Sets (+) or clears (-) the DOS file attributes in the current selection.  An attribute set can include archive (a), system (s), hidden (h), and read only (r) attributes.  win Windows only implementation: Linux version will not recognize ATTRIB.

Examples:

attrib +h

attrib +sh -a

 


BEEP

Usage:

beep

 

Beeps the PC speaker.  The beep occurs regardless of the /silent command line switch.


COLLAPSE

Usage:

collapse all

collapse <path> [<path> [...]]

 

Collapses all folders or folders with specified paths.  Paths are relative to the base folder and can not have wildcards.

Example:

collapse "Folder 1" Folder2\SubFolder

 


COMPARE

Usage:

compare [CRC|binary|rules-based]

 

Compares the contents of the current selection using the compare type.  By default, the most recent compare type is used.

This command only compares files once.  To change how files are compared after modification, use CRITERIA.


COPY

Usage:

copy (lt->rt|rt->lt)

 

Copies the selected files/folders in the direction indicated.


COPYTO

Usage:

copyto [lt|rt|all] [path:(relative|base|none)] <path>

 

Copies the selected files/folders on the specified side to the specified path using the path optionbase keeps the entire folder structure relative to the base folders of all selected items.  relative keeps the minimum relative folder structure of all selected items.

The defaults are all and path:none.


CRITERIA

Usage:

criteria [attrib:<attrib set>] [version] \

         [timestamp[:[#sec][;IgnoreDST]]] \

         [size|CRC|binary|rules-based] \

         [timezone:(ignore|(lt|rt)(+|-)<0..12>)]

 

Sets all comparison criteria settings.

·attrib enables comparisons of the specified DOS file attributes.  Use a for Archive, s for System, h for Hidden, and r for read-only.  win Windows only implementation: Linux version will not recognize attrib.
·version enables comparisons of version information common in exes and dlls.
·timestamp enables timestamp comparisons.
o#sec considers differences within a tolerance of seconds as matches.
oIgnoreDST considers differences of exactly 1 hour as matches.
·size, CRC, binary, and rules-based are the possible ways to compare contents.
·timezone ignores timezone differences or applies timezone offset to the specified side.

Example:

criteria attrib:sh timestamp:2sec;IgnoreDST rules-based timezone:lt+6

 


DELETE

Usage:

delete [recyclebin=(yes|no)] (lt|rt|all)

 

Deletes the currently selected files/folders on the specified side(s).  The recyclebin argument only has effect where supported by Windows.  Windows does not recycle from network drives, FTP sites, and within zip and other archive files.


EXPAND

Usage:

expand <path> [<path> [...]]

expand all

 

Expands specified subfolders, or all subfolders.  Paths are relative to the base folder and can not have wildcards.  Subfolders must be expanded in order for their contents to be used by other commands, like SELECTexpand all will not expand subfolders that have been excluded from the comparison by File Filter settings.


FILE-REPORT

Usage:

file-report layout:<layout> [options:<options>] \

            [title:<report title>] \

            output-to:(printer|clipboard|<filename>) \

            [output-options:<options>] [<filename1> <filename2>]

 

Generates a file comparison report of the currently selected files.

·layout controls the reports appearance, and can be any of over-under, side-by-side, composite, patch, statistics, or xml.
·options is optional, and is used differently for each layout.
oignore-unimportant treats differences in unimportant text as matches and is available in all layouts.
odisplay-all, display-mismatches, display-context, or display-matches can be used to control which lines of the comparison are included in the report and are available in all layouts except patch and statistics.  By default, display-all is used.
oline-numbers includes line numbers in the side-by-side layout.
ostats-descriptive or stats-tabular (CSV) formats are available in the statistics layout.  By default, stats-descriptive is used.
opatch-normal, patch-context, or patch-unified formats are available in the patch layout.  By default, patch-normal is used.

Both file-report and folder-report must include information on where the report should be sent, and may include additional information on the output format.

·title controls the title that appears at the top of the report.
·output-to controls the output target.  It can be printer, clipboard, or a filename.
·output-options is optional and is used differently for each output target.
oprint-color or print-mono color schemes are available for printer output.
oprint-portrait or print-landscape orientations are available for printer output.  By default, print-portrait is used.
owrap-none, wrap-character, or wrap-word control whether long lines are wrapped.  Printer output can use all three options.  HTML output can use wrap-none and wrap-word.  By default, wrap-none is used.
ohtml-color, html-mono, or html-custom=<filename> stylesheets are available for clipboard and file outputs.  If html-custom is used it should include a URL or path, which will be used as the HTML's external style sheet.

Examples:

file-report layout:over-under options:display-context output-to:printer &

            output-options:print-color,wrap-word

file-report layout:patch options:ignore-all,patch-unified &

            output-to:"reports\report.txt"

 


FILTER

Usage:

filter <file masks>

filter cutoff:([<|>](<timestamp>|#[days])|none)

filter attrib:((+|-)<attrib set>|none)

filter size:([<|>]#[KB|MB|GB|TB]|none)

 

Controls which folders and types of files are compared by using name filtering (file masks), date filtering (cutoff), or other filtering (attrib or size).

·Name filters include and exclude files and folders based on their names and paths.  Multiple masks can be separated by semicolons.  To indicate that a mask is an exclude mask use a leading minus (-).  To indicate that a mask affects folders use a trailing backslash (\).
·cutoff excludes all files older (<) or newer (>) than a timestamp or a number of days from the current system date (#days).  By default, cutoff:< is used.  none can be used to remove date filtering.  The date parsing is fairly lenient, but if you want to be sure it parses correctly, use the format specified by the operating system's regional settings.  (See Control Panel > Regional and Language Settings.) The time is optional, and should follow the date (cutoff:"01/01/2001 12:00pm").  Remember to use quotation marks (" ") whenever a term contains a space.
·attrib limits the comparison to files which have an included DOS file attribute (+) and don't have an excluded attribute (-).  none can be used to remove attribute filtering.  Use a for Archive, s for System, h for Hidden, and r for read-only.  win Windows only implementation: Linux version will not recognize attrib.
·size excludes all files smaller (<) or larger (>) than the given size.  By default the size is given in bytes, but you can add KB, MB, or GB to the end to indicate that the value is in kilobytes, megabytes, gigabytes, or terabytes, respectively.  none can be used to remove size filtering.

Examples:

filter "*.pas;*.dpr;*.dfm"

filter cutoff:<7days

filter cutoff:>"Jan 1, 2001"

filter cutoff:"01/01/2001 12:00pm"

filter attrib:-sh

filter "*.txt;-Recycle Bin\" attrib:+r

 


FOLDER-REPORT

Usage:

folder-report layout:<layout> [options:<options>] \

              [title:<report title>] \

              output-to:(printer|clipboard|<filename>) \

              [output-options:<options>]

 

Generates a folder comparison report of the currently loaded base folders.  Folders are shown in their current state.  To include subfolders add an expand all command before this.

·layout controls the reports appearance, and can be side-by-side, summary, or xml.
·options is optional.
oDisplay filter flags control which files are included in the report.  The possible values are display-all, display-mismatches, display-no-orphans, display-mismatches-no-orphans, display-orphans, display-left-newer, display-right-newer, display-left-newer-orphans, display-right-newer-orphans, and display-matches.  By default, display-all is used.
oOptional columns can be included, separated by commas, in the report by using the flags column-version, column-size, column-crc, column-timestamp, column-attributes, column-group, column-owner, and column-vcs.  By default, column-size and column-timestamp are included.  column-none can be used by itself to clear the default columns.
·title, output-to, and output-options arguments are documented under FILE-REPORT.

Examples:

folder-report layout:side-by-side &

              options:column-size,column-version,column-timestamp &

              output-to:clipboard output-options:html-color

folder-report layout:xml output-to:"C:\Folder Report.xml"

 


LOAD

Usage:

load <session>

load <left path> [<right path>]

load <default>

 

Loads the specified session, the specified base folders, or the Default Session Settings (load <default>).  Failure to load a base folder will cause the script to terminate.

·Loading a session causes all that session's settings, except the display filter (show all, only mismatches, only matches, etc.), to be used.
·Loading base folders uses the currently active settings.  By default, the program defaults are used.

Examples:

load "MySession"

load "c:\project 1" "x:\project 1"

load <default>

 


LOG

Usage:

log [none|normal|verbose] [[append:]<filename>]

 

Controls how detailed the log is and where the log is stored.

·none, normal, and verbose determine the amount of detail used in the log.  Logging is initially disabled and begins when the mode is changed from none.
·append: causes logging to add to the file instead of replace it.  By default, the log is output as Log.txt in the current directory (eg, the Windows "Start In" folder in shortcut properties).

MOVE

Usage:

move (lt->rt|rt->lt)

 

Moves the selected files/folders in the direction specified.


OPTION

Usage:

option stop-on-error

option confirm:(prompt|yes-to-all|no-to-all)

 

Adjusts script processing options.

·stop-on-error makes the script watch for various error conditions, including file operation errors, and, when one occurs, prompts the user before continuing.
·confirm can use prompt, yes-to-all, or no-to-all to handle confirmation dialogs that occur due to file operations.  By default, prompt is used.

RENAME

Usage:

rename [regexpr <old mask>] <new mask>

 

Performs a multi-file rename on the current selection using the specified new mask.  regexpr uses an old mask to perform a "Regular Expression Rename".  By default, a DOS-style rename is performed.

Examples:

rename *.bak

rename regexpr (...)(...)\.txt $2$1.txt

 


SELECT

Usage:

select <select mask 1> [<select mask 2> <...>]

 

Select controls which files and folders can be operated on.  Only files and folders that match at least one of the selection masks are part of the selection.  A selection mask has the format, [<side>.][<difference>.][<item>].

·A side (left or lt, right or rt, all) limits the selection to the specified side.  By default, all is used.
·A difference (exact, diff, newer, older, orphan, all) limits the selection based on results of comparison.  diff refers to differences in criteria other than timestamps.  To compare timestamps use newer or older instead.  Folders must contain only the specified result type to be affected.  By default, all is used.
·An item (files, folders, all) limits the selection to files, folders, or both.  By default, all is used.

empty.folders is a special selection mask that will select empty folders.

Examples:

select lt.files rt.orphan.folders

select all

select lt.all

select lt.files.all

select diff

 


SNAPSHOT

Usage:

snapshot [save-crc][save-version][expand-archives][no-filters] \

         lt|rt|path:<path> [output:<target>]

 

Saves a read-only snapshot of the specified folder.

·save-crc calculates CRC's for all files and stores them as part of the snapshot.
·save-version stores version information for executable files.
·expand-archives stores the contents of archive files in an expanded format.
·no-filters stores all files regardless of the active filename filters.
·lt, rt, and path indicate which folder is stored.  lt and rt will save a snapshot of one of the loaded base folders, and path will save a snapshot of a specified path.
·output is optional and determines where the snapshot will be saved.  By default, it will be saved in the current folder.
oIf target is a fully qualified filename, that will be the name of the snapshot.  If target doesn't have an extension, .bcss will be used.
oIf the target isn't included or refers to a folder a filename will be generated based on the source folder's name and the current system date, eg folder_2000-12-31.bcss.  If necessary an additional number will be added to the generated name to keep it from overwriting existing snapshots.

Examples:

snapshot save-crc save-version no-filters path:C:\ output:D:\

snapshot lt output:"Home Copy.bcss"

 


SYNC

Usage:

sync [visible][create-empty] (update|mirror):(lt->rt|rt->lt|all)

 

Uses the Synchronize Folders engine to update a pair of folders.  This command does not use the current selection.

·visible enables "Only affect visible files" behavior.  Only files in expanded folders will be affected.
·create-empty enables the "Create empty folders" behavior.
·update copies newer and orphan files in the indicated direction, leaving orphans and newer files on the opposite side unchanged.  Using all as the direction indicates a bidirectional sync, and copies newer and orphan files in both directions.
·mirror makes the target folder identical to the source one.  Newer, older, different, and orphaned files are all copied to the destination, and orphans in the destination are deleted.  The all direction doesn't apply in this context, and is not valid.

Example:

sync create-empty mirror:lt->rt

 


TOUCH

Usage:

touch (lt->rt|rt->lt)

touch (lt|rt|all):(now|<timestamp>)

 

Copies the timestamps from files on one side to the other, or sets the timestamps of all files on a specified side to the current system time (now) or a specified timestamp.  You must select files before you can touch them.